home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / PUTH.ASM < prev    next >
Assembly Source File  |  1991-11-14  |  863b  |  49 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. ; Contains modifications suggested by David Holm, 10/22/91
  6. ;
  7. stdlib        segment    para public 'slcode'
  8.         assume    cs:stdgrp
  9. ;
  10.         extrn    sl_Putc:far
  11. ;
  12. ;
  13. ; Puth- Outputs value in AL as two hex digits.
  14. ;
  15.         public    sl_Puth
  16. sl_Puth        proc    far
  17.         push    ax
  18.         mov    ah, al
  19.         shr    al, 1
  20.         shr    al, 1
  21.         shr    al, 1
  22.         shr    al, 1
  23.         cmp    al, 0ah        ;Sequence provided by David Holm
  24.         sbb    al, 69h        ; which converts 0-F to "0"-"F"
  25.         das            ; ...
  26.         call    sl_Putc
  27.         mov    al, ah
  28.         and    al, 0fh
  29.         cmp    al, 0ah        ; As above
  30.         sbb    al, 69h        ;
  31.         das            ;
  32.         call    sl_Putc
  33.         pop    ax
  34.         ret
  35. sl_Puth        endp
  36. ;
  37. ; Putw- Outputs word in AX as four hexadecimal digits:
  38. ;
  39.         public    sl_Putw
  40. sl_Putw        proc    far
  41.         xchg    al, ah
  42.         call    sl_Puth
  43.         xchg    al, ah
  44.         jmp    sl_Puth
  45. sl_Putw        endp
  46. ;
  47. stdlib        ends
  48.         end
  49.